package main

import (
	"fmt"
)

// 1、一个返回值
func fool(a string, b int) int {
	fmt.Println("a=", a)
	fmt.Println("b=", b)

	c := 100
	return c
}

// 2、多个返回值 匿名
func fool2(a string, b int) (int, int) {
	fmt.Println("a=", a)
	fmt.Println("b=", b)

	c := 100
	return c, c
}

// 3、多个返回值 形参
func fool3(a string, b int) (r1 int, r2 int) {
	fmt.Println("a=", a)
	fmt.Println("b=", b)
	r1 = 200
	r2 = 1000
	return
}

// 4、返回值相同
func fool4(a string, b int) (r1, r2 int) {
	fmt.Println("a=", a)
	fmt.Println("b=", b)

	r1 = 100
	r2 = 200
	return
}

func main() {
	fmt.Println("hello go")

	c := fool("xd", 100)
	fmt.Println("调用函数后显示的数据c = ", c)

	c1, c2 := fool2("xd", 20)
	fmt.Println("c1=", c1)
	fmt.Println("c2=", c2)

	ret1, ret2 := fool3("xd", 100)
	fmt.Println("ret1=", ret1, "ret2", ret2)

	r1, r2 := fool4("xd", 123)
	println("r1=", r1, "r2=", r2)
}
